/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * IFMunicipios.java
 *
 * Created on 06/02/2012, 08:58:27
 */
package gui.frames.internos;

import controle.gui.frames.internos.ControleImoveis;
import controle.gui.superclasses.InternalFrame;
import gui.componentes.JTextFieldCodigo;

/**
 * Frame interno para gerenciamento de Localidades e Croquis
 * 
 * @author Maycon Fernando Silva Brito
 * @author mayconfsbrito@gmail.com
 */
public class IFImoveis extends InternalFrame {

    /*Variáveis da classe*/
    private ControleImoveis controle = new ControleImoveis(this);
    public SelectionListener listener;
    
    /*Creates new form IFMunicipios*/
    public IFImoveis() {
        initComponents();
        this.listener = new SelectionListener(this.tabela);
        this.inicializa();
    }
    
    @Override
    protected void inicializa() {
        controle.inicializa();
    }
    
    @Override
    protected void limparGUI() {
        controle.limparGUI();
    }

    @Override
    protected void tabelaPreencheGUI(){
        controle.tabelaPreencheGUI();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelInformacoes = new javax.swing.JPanel();
        labelId = new javax.swing.JLabel();
        labelNome = new javax.swing.JLabel();
        labelMunicípio = new javax.swing.JLabel();
        textId = new javax.swing.JTextField();
        textNumero = new javax.swing.JTextField();
        textCodigoMunicipio = new JTextFieldCodigo(7, true);
        textNomeMunicipio = new javax.swing.JTextField();
        textCodigoLocalidade = new JTextFieldCodigo(4, false);
        labelLocalidade = new javax.swing.JLabel();
        labelMunicípio1 = new javax.swing.JLabel();
        labelNome1 = new javax.swing.JLabel();
        labelComplemento = new javax.swing.JLabel();
        textComplemento = new javax.swing.JTextField();
        comboQuadra = new javax.swing.JComboBox();
        textNomeLogradouro = new javax.swing.JTextField();
        textIdLogradouro = new JTextFieldCodigo(4, false);
        buttonSelecionarLogradouro = new javax.swing.JButton();
        textNomeLocalidade = new javax.swing.JTextField();
        buttonSelecionarLocalidade = new javax.swing.JButton();
        panelLocalidades = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabela = new javax.swing.JTable();
        panelBusca = new javax.swing.JPanel();
        labelBuscaNome = new javax.swing.JLabel();
        labelBuscaLogradouro = new javax.swing.JLabel();
        buttonBuscar = new javax.swing.JButton();
        buttonLimparBusca = new javax.swing.JButton();
        textBuscaNumero = new javax.swing.JTextField();
        labelBuscaMunicipio1 = new javax.swing.JLabel();
        textBuscaCodigoMunicipio = new JTextFieldCodigo(7, true);
        textBuscaNomeMunicipio = new javax.swing.JTextField();
        labelBuscaMunicipio = new javax.swing.JLabel();
        textBuscaCodigoLocalidade = new JTextFieldCodigo(4, false);
        labelNome2 = new javax.swing.JLabel();
        comboBuscaQuadra = new javax.swing.JComboBox();
        textBuscaIdLogradouro = new JTextFieldCodigo(4, false);
        buttonBuscaSelecionarLogradouro = new javax.swing.JButton();
        textBuscaNomeLogradouro = new javax.swing.JTextField();
        textBuscaNomeLocalidade = new javax.swing.JTextField();
        buttonBuscaSelecionarLocalidade = new javax.swing.JButton();
        panelOpcoes = new javax.swing.JPanel();
        buttonCancelar = new javax.swing.JButton();
        buttonCadastro = new javax.swing.JButton();
        buttonAlterar = new javax.swing.JButton();
        buttonLimpar = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);
        setTitle("Imóveis");

        panelInformacoes.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Informações do Imóvel", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        labelId.setText("Id:");

        labelNome.setText("Nº:");

        labelMunicípio.setText("Logradouro:");

        textId.setEnabled(false);

        textNumero.setEnabled(false);
        textNumero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textNumeroActionPerformed(evt);
            }
        });

        textCodigoMunicipio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodigoMunicipioActionPerformed(evt);
            }
        });

        textNomeMunicipio.setEnabled(false);

        textCodigoLocalidade.setEnabled(false);
        textCodigoLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodigoLocalidadeActionPerformed(evt);
            }
        });

        labelLocalidade.setText("Localidade:>");

        labelMunicípio1.setText("Município:>");

        labelNome1.setText("Quadra:");

        labelComplemento.setText("Complemento:");

        textComplemento.setEnabled(false);

        comboQuadra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione..." }));
        comboQuadra.setEnabled(false);
        comboQuadra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboQuadraActionPerformed(evt);
            }
        });

        textNomeLogradouro.setEnabled(false);

        textIdLogradouro.setEnabled(false);
        textIdLogradouro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textIdLogradouroActionPerformed(evt);
            }
        });

        buttonSelecionarLogradouro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/BuscarPequeno.png"))); // NOI18N
        buttonSelecionarLogradouro.setEnabled(false);
        buttonSelecionarLogradouro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSelecionarLogradouroActionPerformed(evt);
            }
        });

        textNomeLocalidade.setEnabled(false);

        buttonSelecionarLocalidade.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/BuscarPequeno.png"))); // NOI18N
        buttonSelecionarLocalidade.setEnabled(false);
        buttonSelecionarLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSelecionarLocalidadeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelInformacoesLayout = new javax.swing.GroupLayout(panelInformacoes);
        panelInformacoes.setLayout(panelInformacoesLayout);
        panelInformacoesLayout.setHorizontalGroup(
            panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformacoesLayout.createSequentialGroup()
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelLocalidade)
                            .addComponent(labelMunicípio)
                            .addComponent(labelNome1))
                        .addGap(6, 6, 6)
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(textIdLogradouro)
                            .addComponent(textId)
                            .addComponent(textCodigoLocalidade)
                            .addComponent(comboQuadra, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(labelId))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addComponent(labelMunicípio1)
                        .addGap(18, 18, 18)
                        .addComponent(textCodigoMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textNomeMunicipio))
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(buttonSelecionarLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonSelecionarLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelNome))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelInformacoesLayout.createSequentialGroup()
                                .addComponent(textNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(labelComplemento)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(textComplemento)
                                .addContainerGap())
                            .addComponent(textNomeLocalidade)
                            .addComponent(textNomeLogradouro)))))
        );
        panelInformacoesLayout.setVerticalGroup(
            panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformacoesLayout.createSequentialGroup()
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelId)
                    .addComponent(textId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelMunicípio1)
                    .addComponent(textNomeMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textCodigoMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonSelecionarLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(textCodigoLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(labelLocalidade))
                            .addComponent(textNomeLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonSelecionarLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(labelMunicípio)
                                .addComponent(textIdLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(textNomeLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelNome, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelComplemento)
                        .addComponent(textComplemento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelNome1)
                        .addComponent(comboQuadra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );

        panelLocalidades.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Imóveis Cadastrados", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        tabela.setAutoCreateRowSorter(true);
        tabela.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
        tabela.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Id Imóvel", "Número", "Complemento", "Logradouro", "Cod. Município", "Cod. Localidade", "Quadra"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabela.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(tabela);

        panelBusca.setBorder(javax.swing.BorderFactory.createTitledBorder("Busca"));

        labelBuscaNome.setText("Nº:");

        labelBuscaLogradouro.setText("Logradouro:");

        buttonBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Buscar.png"))); // NOI18N
        buttonBuscar.setText("Buscar");
        buttonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonBuscarActionPerformed(evt);
            }
        });

        buttonLimparBusca.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Limpar.png"))); // NOI18N
        buttonLimparBusca.setText("Limpar Busca");
        buttonLimparBusca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLimparBuscaActionPerformed(evt);
            }
        });

        textBuscaNumero.setEnabled(false);

        labelBuscaMunicipio1.setText("Município:>");

        textBuscaCodigoMunicipio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaCodigoMunicipioActionPerformed(evt);
            }
        });

        textBuscaNomeMunicipio.setEnabled(false);

        labelBuscaMunicipio.setText("Localidade:>");

        textBuscaCodigoLocalidade.setEnabled(false);
        textBuscaCodigoLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaCodigoLocalidadeActionPerformed(evt);
            }
        });

        labelNome2.setText("Quadra:");

        comboBuscaQuadra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione..." }));
        comboBuscaQuadra.setEnabled(false);
        comboBuscaQuadra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboBuscaQuadraActionPerformed(evt);
            }
        });

        textBuscaIdLogradouro.setEnabled(false);
        textBuscaIdLogradouro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaIdLogradouroActionPerformed(evt);
            }
        });

        buttonBuscaSelecionarLogradouro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/BuscarPequeno.png"))); // NOI18N
        buttonBuscaSelecionarLogradouro.setEnabled(false);
        buttonBuscaSelecionarLogradouro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonBuscaSelecionarLogradouroActionPerformed(evt);
            }
        });

        textBuscaNomeLogradouro.setEnabled(false);

        textBuscaNomeLocalidade.setEnabled(false);

        buttonBuscaSelecionarLocalidade.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/BuscarPequeno.png"))); // NOI18N
        buttonBuscaSelecionarLocalidade.setEnabled(false);
        buttonBuscaSelecionarLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonBuscaSelecionarLocalidadeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBuscaLayout = new javax.swing.GroupLayout(panelBusca);
        panelBusca.setLayout(panelBuscaLayout);
        panelBuscaLayout.setHorizontalGroup(
            panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBuscaLayout.createSequentialGroup()
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelBuscaMunicipio1)
                    .addComponent(labelBuscaMunicipio)
                    .addComponent(labelBuscaLogradouro))
                .addGap(15, 15, 15)
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelBuscaLayout.createSequentialGroup()
                        .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(textBuscaCodigoLocalidade, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
                            .addComponent(textBuscaCodigoMunicipio, javax.swing.GroupLayout.Alignment.LEADING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelBuscaLayout.createSequentialGroup()
                                .addComponent(buttonBuscaSelecionarLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(textBuscaNomeLocalidade))
                            .addComponent(textBuscaNomeMunicipio)))
                    .addGroup(panelBuscaLayout.createSequentialGroup()
                        .addComponent(textBuscaIdLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buttonBuscaSelecionarLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textBuscaNomeLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelNome2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboBuscaQuadra, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(labelBuscaNome)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textBuscaNumero, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))))
            .addGroup(panelBuscaLayout.createSequentialGroup()
                .addComponent(buttonBuscar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonLimparBusca)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        panelBuscaLayout.setVerticalGroup(
            panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBuscaLayout.createSequentialGroup()
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelBuscaMunicipio1)
                    .addComponent(textBuscaNomeMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textBuscaCodigoMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelBuscaMunicipio)
                        .addComponent(textBuscaCodigoLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(textBuscaNomeLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonBuscaSelecionarLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonBuscaSelecionarLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelBuscaLogradouro)
                        .addComponent(textBuscaIdLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(textBuscaNomeLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelNome2)
                        .addComponent(comboBuscaQuadra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelBuscaNome)
                        .addComponent(textBuscaNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, 0)
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonBuscar)
                    .addComponent(buttonLimparBusca)))
        );

        javax.swing.GroupLayout panelLocalidadesLayout = new javax.swing.GroupLayout(panelLocalidades);
        panelLocalidades.setLayout(panelLocalidadesLayout);
        panelLocalidadesLayout.setHorizontalGroup(
            panelLocalidadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelLocalidadesLayout.createSequentialGroup()
                .addGroup(panelLocalidadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addComponent(panelBusca, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 0, 0))
        );
        panelLocalidadesLayout.setVerticalGroup(
            panelLocalidadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelLocalidadesLayout.createSequentialGroup()
                .addComponent(panelBusca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE))
        );

        panelOpcoes.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Opções", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        buttonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Cancelar.png"))); // NOI18N
        buttonCancelar.setText("Cancelar");
        buttonCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCancelarActionPerformed(evt);
            }
        });

        buttonCadastro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Confirma.png"))); // NOI18N
        buttonCadastro.setText("Cadastrar");
        buttonCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCadastroActionPerformed(evt);
            }
        });

        buttonAlterar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Alterar.png"))); // NOI18N
        buttonAlterar.setText("Alterar");
        buttonAlterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonAlterarActionPerformed(evt);
            }
        });

        buttonLimpar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Novo.png"))); // NOI18N
        buttonLimpar.setText("Novo/Limpar");
        buttonLimpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLimparActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelOpcoesLayout = new javax.swing.GroupLayout(panelOpcoes);
        panelOpcoes.setLayout(panelOpcoesLayout);
        panelOpcoesLayout.setHorizontalGroup(
            panelOpcoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelOpcoesLayout.createSequentialGroup()
                .addComponent(buttonCadastro)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonAlterar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonLimpar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonCancelar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelOpcoesLayout.setVerticalGroup(
            panelOpcoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(buttonCadastro)
            .addGroup(panelOpcoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(buttonAlterar)
                .addComponent(buttonLimpar)
                .addComponent(buttonCancelar))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelLocalidades, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panelInformacoes, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panelOpcoes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(panelLocalidades, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelInformacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelOpcoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCadastroActionPerformed
        controle.cadastrar();
    }//GEN-LAST:event_buttonCadastroActionPerformed

    private void buttonAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAlterarActionPerformed
        controle.alterar();
    }//GEN-LAST:event_buttonAlterarActionPerformed

    private void buttonBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBuscarActionPerformed
        controle.buscar();
    }//GEN-LAST:event_buttonBuscarActionPerformed

    private void buttonLimparBuscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLimparBuscaActionPerformed
        controle.limparBusca();
    }//GEN-LAST:event_buttonLimparBuscaActionPerformed

    private void textCodigoMunicipioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCodigoMunicipioActionPerformed
        controle.eventoTextCodigoMunicipio(this.textCodigoLocalidade, this.textNomeLocalidade, this.buttonSelecionarLocalidade, 
                this.textCodigoMunicipio, this.textNomeMunicipio);
    }//GEN-LAST:event_textCodigoMunicipioActionPerformed

    private void textCodigoLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCodigoLocalidadeActionPerformed
        controle.eventoTextCodigoLocalidade(this.textCodigoLocalidade, this.textNomeLocalidade, this.textCodigoMunicipio, null, 
                this.buttonSelecionarLogradouro, this.textIdLogradouro, this.textNomeLogradouro);
    }//GEN-LAST:event_textCodigoLocalidadeActionPerformed

    private void textBuscaCodigoMunicipioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaCodigoMunicipioActionPerformed
        controle.eventoTextCodigoMunicipio(this.textBuscaCodigoLocalidade, this.textBuscaNomeLocalidade, this.buttonBuscaSelecionarLocalidade, 
                this.textBuscaCodigoMunicipio, this.textBuscaNomeMunicipio);
    }//GEN-LAST:event_textBuscaCodigoMunicipioActionPerformed

    private void textBuscaCodigoLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaCodigoLocalidadeActionPerformed
        controle.eventoTextCodigoLocalidade(this.textBuscaCodigoLocalidade, this.textBuscaNomeLocalidade, this.textBuscaCodigoMunicipio, 
                this.comboBuscaQuadra, this.buttonBuscaSelecionarLogradouro, this.textBuscaIdLogradouro, this.textBuscaNomeLogradouro);
    }//GEN-LAST:event_textBuscaCodigoLocalidadeActionPerformed

    private void textNumeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textNumeroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textNumeroActionPerformed

    private void comboQuadraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboQuadraActionPerformed
        controle.eventoComboQuadra(comboQuadra, false);
    }//GEN-LAST:event_comboQuadraActionPerformed

    private void textIdLogradouroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textIdLogradouroActionPerformed
        
    }//GEN-LAST:event_textIdLogradouroActionPerformed

    private void buttonSelecionarLogradouroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSelecionarLogradouroActionPerformed
        controle.eventoButtonSelecionarLogradouro(textCodigoMunicipio.getText(),false);
    }//GEN-LAST:event_buttonSelecionarLogradouroActionPerformed

    private void buttonSelecionarLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSelecionarLocalidadeActionPerformed
        controle.eventoBuscarLocalidade(controle, this, textCodigoMunicipio.getText(), false);
    }//GEN-LAST:event_buttonSelecionarLocalidadeActionPerformed

    private void textBuscaIdLogradouroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaIdLogradouroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textBuscaIdLogradouroActionPerformed

    private void buttonBuscaSelecionarLogradouroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBuscaSelecionarLogradouroActionPerformed
        controle.eventoButtonSelecionarLogradouro(textBuscaCodigoMunicipio.getText(), true);
    }//GEN-LAST:event_buttonBuscaSelecionarLogradouroActionPerformed

    private void buttonBuscaSelecionarLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBuscaSelecionarLocalidadeActionPerformed
        controle.eventoBuscarLocalidade(controle, this, textBuscaCodigoMunicipio.getText(), true);
    }//GEN-LAST:event_buttonBuscaSelecionarLocalidadeActionPerformed

    private void comboBuscaQuadraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBuscaQuadraActionPerformed
        controle.eventoComboQuadra(comboBuscaQuadra, true);
    }//GEN-LAST:event_comboBuscaQuadraActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton buttonAlterar;
    public javax.swing.JButton buttonBuscaSelecionarLocalidade;
    public javax.swing.JButton buttonBuscaSelecionarLogradouro;
    public javax.swing.JButton buttonBuscar;
    public javax.swing.JButton buttonCadastro;
    public javax.swing.JButton buttonCancelar;
    public javax.swing.JButton buttonLimpar;
    public javax.swing.JButton buttonLimparBusca;
    public javax.swing.JButton buttonSelecionarLocalidade;
    public javax.swing.JButton buttonSelecionarLogradouro;
    public javax.swing.JComboBox comboBuscaQuadra;
    public javax.swing.JComboBox comboQuadra;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel labelBuscaLogradouro;
    private javax.swing.JLabel labelBuscaMunicipio;
    private javax.swing.JLabel labelBuscaMunicipio1;
    private javax.swing.JLabel labelBuscaNome;
    private javax.swing.JLabel labelComplemento;
    private javax.swing.JLabel labelId;
    private javax.swing.JLabel labelLocalidade;
    private javax.swing.JLabel labelMunicípio;
    private javax.swing.JLabel labelMunicípio1;
    private javax.swing.JLabel labelNome;
    private javax.swing.JLabel labelNome1;
    private javax.swing.JLabel labelNome2;
    private javax.swing.JPanel panelBusca;
    private javax.swing.JPanel panelInformacoes;
    private javax.swing.JPanel panelLocalidades;
    private javax.swing.JPanel panelOpcoes;
    public javax.swing.JTable tabela;
    public javax.swing.JTextField textBuscaCodigoLocalidade;
    public javax.swing.JTextField textBuscaCodigoMunicipio;
    public javax.swing.JTextField textBuscaIdLogradouro;
    public javax.swing.JTextField textBuscaNomeLocalidade;
    public javax.swing.JTextField textBuscaNomeLogradouro;
    public javax.swing.JTextField textBuscaNomeMunicipio;
    public javax.swing.JTextField textBuscaNumero;
    public javax.swing.JTextField textCodigoLocalidade;
    public javax.swing.JTextField textCodigoMunicipio;
    public javax.swing.JTextField textComplemento;
    public javax.swing.JTextField textId;
    public javax.swing.JTextField textIdLogradouro;
    public javax.swing.JTextField textNomeLocalidade;
    public javax.swing.JTextField textNomeLogradouro;
    public javax.swing.JTextField textNomeMunicipio;
    public javax.swing.JTextField textNumero;
    // End of variables declaration//GEN-END:variables
}
